package com.wantup.dubbo.group;

import com.alibaba.dubbo.rpc.RpcContext;
import com.wantup.dubbo.service.ServiceApi;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;
import java.util.Scanner;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 * Hello world!
 *
 */
public class GroupConsumerApp
{
    public static void main( String[] args ) throws ExecutionException, InterruptedException {
        //System.out.println( "ConsumerApp --> Hello World!" );
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-group-consumer.xml");
        context.start();//创建容器 读取配置文件

        while (true){
            Scanner scanner = new Scanner(System.in);
            String msg = scanner.next();
            //获取接口
            ServiceApi serviceApi = (ServiceApi) context.getBean("consumerService");
//            String s = serviceApi.sendMsg(msg);
//            System.out.println("s --> "+s);
            List<String> list = serviceApi.mergerMsg(msg);
            for (String s : list) {
                System.out.println(s);
            }

        }

    }
}
